
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>ffmpeg · Aivin开发笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Aivin">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-versions-select/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="ffmpeg基础.html" />
    
    
    <link rel="prev" href="../SDL/SDL基础.html" />
    

    
        <link rel="shortcut icon" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    项目说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../linux/linux基础.html">
            
                <a href="../linux/linux基础.html">
            
                    
                    linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../linux/linux基础.html">
            
                <a href="../linux/linux基础.html">
            
                    
                    linux基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../linux/android底层开发.html">
            
                <a href="../linux/android底层开发.html">
            
                    
                    android底层开发
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../c语言/c基础.html">
            
                <a href="../c语言/c基础.html">
            
                    
                    c
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../c语言/c基础.html">
            
                <a href="../c语言/c基础.html">
            
                    
                    c基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../c++/c++基础.html">
            
                <a href="../c++/c++基础.html">
            
                    
                    c++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../c++/c++基础.html">
            
                <a href="../c++/c++基础.html">
            
                    
                    c++基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../QT/QT基础.html">
            
                <a href="../QT/QT基础.html">
            
                    
                    QT
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../QT/QT基础.html">
            
                <a href="../QT/QT基础.html">
            
                    
                    QT基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../jni/JNI基础.html">
            
                <a href="../jni/JNI基础.html">
            
                    
                    JNI
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../jni/JNI基础.html">
            
                <a href="../jni/JNI基础.html">
            
                    
                    JNI基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../jni/JNI例子.html">
            
                <a href="../jni/JNI例子.html">
            
                    
                    JNI例子
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../SDL/SDL基础.html">
            
                <a href="../SDL/SDL基础.html">
            
                    
                    SDL
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../SDL/SDL基础.html">
            
                <a href="../SDL/SDL基础.html">
            
                    
                    SDL基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="1.8" data-path="ffmpeg基础.html">
            
                <a href="ffmpeg基础.html">
            
                    
                    ffmpeg
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.8.1" data-path="ffmpeg基础.html">
            
                <a href="ffmpeg基础.html">
            
                    
                    ffmpeg基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="ffmpeg示例代码.html">
            
                <a href="ffmpeg示例代码.html">
            
                    
                    ffmpeg示例代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="ffmpeg软解rtsp简单直播.html">
            
                <a href="ffmpeg软解rtsp简单直播.html">
            
                    
                    ffmpeg软解rtsp简单直播
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="rtsp服务器.html">
            
                <a href="rtsp服务器.html">
            
                    
                    rtsp服务器Windows
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../opencv/opencv模块.html">
            
                <a href="../opencv/opencv模块.html">
            
                    
                    opencv模块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../opencv/opencv.html">
            
                <a href="../opencv/opencv.html">
            
                    
                    opencv
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../openSLES/openSLES基础.html">
            
                <a href="../openSLES/openSLES基础.html">
            
                    
                    openSLES
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../openSLES/openSLES基础.html">
            
                <a href="../openSLES/openSLES基础.html">
            
                    
                    openSLES基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../SoundTouch/移植SoundTouch.html">
            
                <a href="../SoundTouch/移植SoundTouch.html">
            
                    
                    SoundTouch
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../SoundTouch/移植SoundTouch.html">
            
                <a href="../SoundTouch/移植SoundTouch.html">
            
                    
                    移植SoundTouch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../SoundTouch/实现音频变速和变调.html">
            
                <a href="../SoundTouch/实现音频变速和变调.html">
            
                    
                    实现音频变速和变调
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../openGLES/openGLES基础.html">
            
                <a href="../openGLES/openGLES基础.html">
            
                    
                    openGLES模块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../openGLES/GLSL基础.html">
            
                <a href="../openGLES/GLSL基础.html">
            
                    
                    GLSL基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../openGLES/openglES示例.html">
            
                <a href="../openGLES/openglES示例.html">
            
                    
                    openglES示例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../视频相关/音视频基础.html">
            
                <a href="../视频相关/音视频基础.html">
            
                    
                    音视频术语-文件格式-协议
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../视频相关/音视频基础.html">
            
                <a href="../视频相关/音视频基础.html">
            
                    
                    音视频基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../视频相关/RTSP.html">
            
                <a href="../视频相关/RTSP.html">
            
                    
                    RTSP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../视频相关/RTP.html">
            
                <a href="../视频相关/RTP.html">
            
                    
                    RTP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" data-path="../视频相关/RTCP.html">
            
                <a href="../视频相关/RTCP.html">
            
                    
                    RTCP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.5" data-path="../视频相关/H264.html">
            
                <a href="../视频相关/H264.html">
            
                    
                    H264
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.6" data-path="../视频相关/YUV.html">
            
                <a href="../视频相关/YUV.html">
            
                    
                    YUV
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.7" data-path="../视频相关/SurfaceView.html">
            
                <a href="../视频相关/SurfaceView.html">
            
                    
                    SurfaceView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.8" data-path="../视频相关/RTMP.html">
            
                <a href="../视频相关/RTMP.html">
            
                    
                    RTMP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.9" data-path="../视频相关/AAC详解.html">
            
                <a href="../视频相关/AAC详解.html">
            
                    
                    AAC详解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../音视频相关代码/音视频相关代码.html">
            
                <a href="../音视频相关代码/音视频相关代码.html">
            
                    
                    音视频相关代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../ndk/NDK编译基础.html">
            
                <a href="../ndk/NDK编译基础.html">
            
                    
                    NDK工程编译
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../ndk/NDK编译基础.html">
            
                <a href="../ndk/NDK编译基础.html">
            
                    
                    NDK编译基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../ndk/cmake方式.html">
            
                <a href="../ndk/cmake方式.html">
            
                    
                    cmake
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../ndk/Android.mk模板.html">
            
                <a href="../ndk/Android.mk模板.html">
            
                    
                    Android.mk
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../ndk/Application.mk模板.html">
            
                <a href="../ndk/Application.mk模板.html">
            
                    
                    Application.mk
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >ffmpeg</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#ffmpeg"><b>1. </b>ffmpeg</a></li><ul><li><span class="title-icon "></span><a href="#ffmpeg&#x4E3B;&#x8981;&#x6A21;&#x5757;"><b>1.1. </b>FFmpeg&#x4E3B;&#x8981;&#x6A21;&#x5757;</a></li><li><span class="title-icon "></span><a href="#&#x79FB;&#x690D;ffmpeg&#x5230;&#x5B89;&#x5353;"><b>1.2. </b>&#x79FB;&#x690D;ffmpeg&#x5230;&#x5B89;&#x5353;</a></li><ul><li><span class="title-icon "></span><a href="#&#x7F16;&#x8BD1;ffmpeg&#x5F97;&#x5230;so&#x7B49;&#x76F8;&#x5173;&#x6587;&#x4EF6;"><b>1.2.1. </b>&#x7F16;&#x8BD1;ffmpeg&#x5F97;&#x5230;so&#x7B49;&#x76F8;&#x5173;&#x6587;&#x4EF6;</a></li><li><span class="title-icon "></span><a href="#androidstudio-&#x96C6;&#x6210;ffmpeg"><b>1.2.2. </b>androidStudio &#x96C6;&#x6210;ffmpeg</a></li></ul><li><span class="title-icon "></span><a href="#&#x7248;&#x672C;&#x517C;&#x5BB9;"><b>1.3. </b>&#x7248;&#x672C;&#x517C;&#x5BB9;</a></li><li><span class="title-icon "></span><a href="#ffmpeg-&#x5E38;&#x7528;&#x7ED3;&#x6784;&#x4F53;"><b>1.4. </b>ffmpeg &#x5E38;&#x7528;&#x7ED3;&#x6784;&#x4F53;</a></li><li><span class="title-icon "></span><a href="#ffmpeg&#x5E38;&#x7528;&#x51FD;&#x6570;"><b>1.5. </b>ffmpeg&#x5E38;&#x7528;&#x51FD;&#x6570;</a></li><li><span class="title-icon "></span><a href="#&#x89C6;&#x97F3;&#x89C6;&#x9891;&#x540C;&#x6B65;"><b>1.6. </b>&#x89C6;&#x97F3;&#x89C6;&#x9891;&#x540C;&#x6B65;</a></li><ul><li><span class="title-icon "></span><a href="#&#x4E3A;&#x4EC0;&#x4E48;&#x4F1A;&#x51FA;&#x73B0;&#x97F3;&#x9891;&#x4E0D;&#x540C;&#x6B65;&#xFF1F;"><b>1.6.1. </b>&#x4E3A;&#x4EC0;&#x4E48;&#x4F1A;&#x51FA;&#x73B0;&#x97F3;&#x9891;&#x4E0D;&#x540C;&#x6B65;&#xFF1F;</a></li><li><span class="title-icon "></span><a href="#&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x65B9;&#x6848;"><b>1.6.2. </b>&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x65B9;&#x6848;</a></li><li><span class="title-icon "></span><a href="#&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x539F;&#x7406;"><b>1.6.3. </b>&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x539F;&#x7406;</a></li><li><span class="title-icon "></span><a href="#&#x65F6;&#x95F4;&#x6233;&#x548C;&#x65F6;&#x95F4;&#x57FA;&#x7684;&#x7406;&#x89E3;"><b>1.6.4. </b>&#x65F6;&#x95F4;&#x6233;&#x548C;&#x65F6;&#x95F4;&#x57FA;&#x7684;&#x7406;&#x89E3;</a></li></ul><li><span class="title-icon "></span><a href="#windows-&#x4E0A;&#x4F7F;&#x7528;-ffmpeg"><b>1.7. </b>Windows &#x4E0A;&#x4F7F;&#x7528; ffmpeg</a></li><ul><li><span class="title-icon "></span><a href="#&#x5B89;&#x88C5;ffmpeg"><b>1.7.1. </b>&#x5B89;&#x88C5;ffmpeg</a></li><li><span class="title-icon "></span><a href="#ffmpeg-&#x5E38;&#x7528;&#x547D;&#x4EE4;"><b>1.7.2. </b>ffmpeg &#x5E38;&#x7528;&#x547D;&#x4EE4;</a></li></ul></ul></ul></div><a href="#ffmpeg" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="ffmpeg"><a name="ffmpeg" class="anchor-navigation-ex-anchor" href="#ffmpeg"><i class="fa fa-link" aria-hidden="true"></i></a>1. ffmpeg</h1>
<p><a href="http://ffmpeg.org/" target="_blank">ffmpeg&#x5B98;&#x7F51;</a> <br>
<a href="https://github.com/FFmpeg/FFmpeg" target="_blank">ffmpeg Github</a> <br>
<a href="http://ffmpeg.org/documentation.html" target="_blank">&#x5B98;&#x65B9;&#x82F1;&#x6587;&#x6587;&#x6863;</a> <br>
<a href="http://ffmpeg.org/ffmpeg.htm" target="_blank">ffmpeg&#x53C2;&#x6570; &#x6587;&#x6863;</a></p>
<h2 id="ffmpeg&#x4E3B;&#x8981;&#x6A21;&#x5757;"><a name="ffmpeg&#x4E3B;&#x8981;&#x6A21;&#x5757;" class="anchor-navigation-ex-anchor" href="#ffmpeg&#x4E3B;&#x8981;&#x6A21;&#x5757;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. FFmpeg&#x4E3B;&#x8981;&#x6A21;&#x5757;</h2>
<pre><code class="lang-html">libavcodec&#xFF1A;    &#x7528;&#x4E8E;&#x5404;&#x79CD;&#x7C7B;&#x578B;&#x58F0;&#x97F3;/&#x56FE;&#x50CF;&#x7F16;&#x89E3;&#x7801;&#xFF1B;
libavdevice&#xFF1A;   &#x7528;&#x4E8E;&#x89C6;&#x9891;&#x91C7;&#x96C6;&#x8BBF;&#x95EE;&#x6444;&#x50CF;&#x5934;&#x7B49;
libavfilter&#xFF1A;   &#x7528;&#x505A;&#x6EE4;&#x955C;&#x5904;&#x7406;
libavformat&#xFF1A;   &#x7528;&#x4E8E;&#x5404;&#x79CD;&#x97F3;&#x89C6;&#x9891;&#x5C01;&#x88C5;&#x683C;&#x5F0F;&#x7684;&#x751F;&#x6210;&#x548C;&#x89E3;&#x6790;&#xFF0C;&#x5305;&#x62EC;&#x83B7;&#x53D6;&#x89E3;&#x7801;&#x6240;&#x9700;&#x4FE1;&#x606F;&#x4EE5;&#x751F;&#x6210;&#x89E3;&#x7801;
                &#x4E0A;&#x4E0B;&#x6587;&#x7ED3;&#x6784;&#x548C;&#x8BFB;&#x53D6;&#x97F3;&#x89C6;&#x9891;&#x5E27;&#x7B49;&#x529F;&#x80FD;&#xFF1B;
libswresample&#xFF1A; &#x7528;&#x4E8E;&#x91CD;&#x91C7;&#x6837;&#xFF1B;
libavutil&#xFF1A;     &#x5305;&#x542B;&#x4E00;&#x4E9B;&#x516C;&#x5171;&#x7684;&#x5DE5;&#x5177;&#x51FD;&#x6570;&#xFF1B;
libswscale&#xFF1A;    &#x7528;&#x4E8E;&#x89C6;&#x9891;&#x573A;&#x666F;&#x6BD4;&#x4F8B;&#x7F29;&#x653E;&#x3001;&#x8272;&#x5F69;&#x6620;&#x5C04;&#x8F6C;&#x6362;&#xFF1B;
libpostproc&#xFF1A;   &#x7528;&#x4E8E;&#x540E;&#x671F;&#x6548;&#x679C;&#x5904;&#x7406;&#xFF1B;
</code></pre>
<h2 id="&#x79FB;&#x690D;ffmpeg&#x5230;&#x5B89;&#x5353;"><a name="&#x79FB;&#x690D;ffmpeg&#x5230;&#x5B89;&#x5353;" class="anchor-navigation-ex-anchor" href="#&#x79FB;&#x690D;ffmpeg&#x5230;&#x5B89;&#x5353;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. &#x79FB;&#x690D;ffmpeg&#x5230;&#x5B89;&#x5353;</h2>
<p><a href="https://blog.csdn.net/ywl5320/article/details/75136986" target="_blank">&#x53C2;&#x8003;&#x8D44;&#x6599;</a></p>
<h3 id="&#x7F16;&#x8BD1;ffmpeg&#x5F97;&#x5230;so&#x7B49;&#x76F8;&#x5173;&#x6587;&#x4EF6;"><a name="&#x7F16;&#x8BD1;ffmpeg&#x5F97;&#x5230;so&#x7B49;&#x76F8;&#x5173;&#x6587;&#x4EF6;" class="anchor-navigation-ex-anchor" href="#&#x7F16;&#x8BD1;ffmpeg&#x5F97;&#x5230;so&#x7B49;&#x76F8;&#x5173;&#x6587;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.1. &#x7F16;&#x8BD1;ffmpeg&#x5F97;&#x5230;so&#x7B49;&#x76F8;&#x5173;&#x6587;&#x4EF6;</h3>
<pre><code class="lang-xml">1&#x3001;&#x5728;ubuntu&#x4E0B;&#x914D;&#x7F6E;&#x597D;ndk&#x73AF;&#x5883;
2&#x3001;&#x4E0B;&#x8F7D;&#x5408;&#x9002;&#x7684;&#x7248;&#x672C;&#x4E0B;&#x8F7D;(ffmpeg-3.3.7.tar.gz) http://ffmpeg.org/download.html#releases
3&#x3001;&#x89E3;&#x538B;&#xFF0C;&#x8D4B;&#x4E88;&#x6700;&#x9AD8;&#x6743;&#x9650;

4&#x3001;&#x7531;&#x4E8E;ffmpeg&#x9ED8;&#x8BA4;&#x751F;&#x6210;&#x7684;&#x683C;&#x5F0F;&#x662F; xxx.so.&#x7248;&#x672C;&#x53F7;, android&#x53EA;&#x80FD;&#x8BC6;&#x522B; xxx.&#x7248;&#x672C;&#x53F7;.so
&#x6240;&#x4EE5;&#x9700;&#x8981;&#x4FEE;&#x6539; configure &#x8FD9;&#x4E2A;&#x6587;&#x4EF6;
# &#x4FEE;&#x6539;&#x524D;
#SLIBNAME_WITH_MAJOR=&apos;$(SLIBNAME).$(LIBMAJOR)&apos;
#LIB_INSTALL_EXTRA_CMD=&apos;$$(RANLIB) &quot;$(LIBDIR)/$(LIBNAME)&quot;&apos;
#SLIB_INSTALL_NAME=&apos;$(SLIBNAME_WITH_VERSION)&apos;
#SLIB_INSTALL_LINKS=&apos;$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)&apos;
# &#x4FEE;&#x6539;&#x540E;
SLIBNAME_WITH_MAJOR=&apos;$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)&apos;
LIB_INSTALL_EXTRA_CMD=&apos;$$(RANLIB) &quot;$(LIBDIR)/$(LIBNAME)&quot;&apos;
SLIB_INSTALL_NAME=&apos;$(SLIBNAME_WITH_MAJOR)&apos;
SLIB_INSTALL_LINKS=&apos;$(SLIBNAME)&apos;

5&#x3001;&#x5728; &#x76F8;&#x540C;&#x76EE;&#x5F55;&#x4E0B;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;build_android.sh
#!/bin/bash
make clean
export NDK=/home/aivin/aivinSpace/ndk-r10e/android-ndk-r10e
export SYSROOT=$NDK/platforms/android-9/arch-arm/
export TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
export CPU=arm
export PREFIX=$(pwd)/android/$CPU
export ADDI_CFLAGS=&quot;-marm&quot;

./configure --target-os=linux \
--prefix=$PREFIX --arch=arm \
--enable-shared \
--disable-static \
--disable-yasm \
--disable-symver \
--enable-gpl \
--enable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags=&quot;-Os -fpic $ADDI_CFLAGS&quot; \
--extra-ldflags=&quot;$ADDI_LDFLAGS&quot; \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install

6&#x3001;&#x5728;build_android.sh &#x76EE;&#x5F55;&#x4E0B;&#x7528;&#x7EC8;&#x7AEF;&#x8F93;&#x5165;  ./build_android.sh
&#x6267;&#x884C;&#x5B8C;&#x6BD5;&#x540E;&#x5728;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E0B;&#x751F;&#x6210; android&#x6587;&#x4EF6;&#x5939;&#x3002;
</code></pre>
<h4 id="&#x4EE5;&#x4E0B;&#x662F;&#x7F51;&#x53CB;&#x7ED9;&#x7684;&#x4E00;&#x4E2A;&#x811A;&#x672C;"><a name="&#x4EE5;&#x4E0B;&#x662F;&#x7F51;&#x53CB;&#x7ED9;&#x7684;&#x4E00;&#x4E2A;&#x811A;&#x672C;" class="anchor-navigation-ex-anchor" href="#&#x4EE5;&#x4E0B;&#x662F;&#x7F51;&#x53CB;&#x7ED9;&#x7684;&#x4E00;&#x4E2A;&#x811A;&#x672C;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4EE5;&#x4E0B;&#x662F;&#x7F51;&#x53CB;&#x7ED9;&#x7684;&#x4E00;&#x4E2A;&#x811A;&#x672C;</h4>
<pre><code class="lang-xml">&#x5148;&#x4FEE;&#x6539; configure&#x6587;&#x4EF6;
&#x7136;&#x540E;&#x76F4;&#x63A5;&#x6267;&#x884C; build_android.sh&#x6587;&#x4EF6;&#xFF08;&#x4E0D;&#x7528;&#x6267;&#x884C;configure&#x6587;&#x4EF6;&#xFF09;
//&#x5728;3.3.7 &#x3001;3.3.8&#x7248;&#x672C;&#x4E2D;&#x53EF;&#x4EE5;&#x7F16;&#x8BD1;&#x901A;&#x8FC7;&#xFF0C;&#x5728;3.4.4&#x901A;&#x4E0D;&#x8FC7;
--target-os=linux
// &#x6240;&#x4EE5;&#x6211;&#x5168;&#x90E8;&#x6539;&#x7528; android&#x914D;&#x7F6E;
--target-os=android
</code></pre>
<pre><code class="lang-xml">#!/bin/bash
export NDK_HOME=/home/aivin/aivinSpace/ndk-r10e/android-ndk-r10e
export PLATFORM_VERSION=android-9
function build
{
    echo &quot;start build ffmpeg for $ARCH&quot;
    ./configure --target-os=android \
    --prefix=$PREFIX --arch=$ARCH \
    --disable-doc \
    --enable-shared \
    --disable-static \
    --disable-yasm \
    --disable-asm \
    --disable-symver \
    --enable-gpl \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --cross-prefix=$CROSS_COMPILE \
    --enable-cross-compile \
    --sysroot=$SYSROOT \
    --enable-small \
    --extra-cflags=&quot;-Os -fpic $ADDI_CFLAGS&quot; \
    --extra-ldflags=&quot;$ADDI_LDFLAGS&quot; \
    $ADDITIONAL_CONFIGURE_FLAG
    make clean
    make
    make install
    echo &quot;build ffmpeg for $ARCH finished&quot;
}

#arm
ARCH=arm
CPU=arm
PREFIX=$(pwd)/android/$ARCH
TOOLCHAIN=$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi-
ADDI_CFLAGS=&quot;-marm&quot;
SYSROOT=$NDK_HOME/platforms/$PLATFORM_VERSION/arch-$ARCH/
build

#x86
ARCH=x86
CPU=x86
PREFIX=$(pwd)/android/$ARCH
TOOLCHAIN=$NDK_HOME/toolchains/x86-4.9/prebuilt/linux-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/i686-linux-android-
ADDI_CFLAGS=&quot;-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32&quot;
SYSROOT=$NDK_HOME/platforms/$PLATFORM_VERSION/arch-$ARCH/
build
</code></pre>
<h4 id="buildandroidarmeabi-v7a-&#x9488;&#x5BF9;armeabi-v7a&#x5E73;&#x53F0;"><a name="buildandroidarmeabi-v7a-&#x9488;&#x5BF9;armeabi-v7a&#x5E73;&#x53F0;" class="anchor-navigation-ex-anchor" href="#buildandroidarmeabi-v7a-&#x9488;&#x5BF9;armeabi-v7a&#x5E73;&#x53F0;"><i class="fa fa-link" aria-hidden="true"></i></a>build_android_armeabi-v7a &#x9488;&#x5BF9;armeabi-V7a&#x5E73;&#x53F0;</h4>
<p>&#x4F7F;&#x7528; neon &#x8FDB;&#x884C;&#x4F18;&#x5316;
-mfpu=neon</p>
<pre><code class="lang-xml">#!/bin/bash
make clean
export NDK=/usr/work/ndk/android-ndk-r14b
export SYSROOT=$NDK/platforms/android-9/arch-arm/
export TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
export CPU=armeabi-v7a
export PREFIX=$(pwd)/android/$CPU
export ADDI_CFLAGS=&quot;-march=armv7-a -mfloat-abi=softfp -mfpu=neon&quot;
export ADDI_LDFLAGS=&quot;-Wl,--fix-cortex-a8&quot;

./configure --target-os=android \
--prefix=$PREFIX --arch=arm \
--enable-shared \
--disable-static \
--disable-yasm \
--disable-symver \
--enable-gpl \
--enable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags=&quot;-Os -fpic $ADDI_CFLAGS&quot; \
--extra-ldflags=&quot;$ADDI_LDFLAGS&quot; \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install
</code></pre>
<h3 id="androidstudio-&#x96C6;&#x6210;ffmpeg"><a name="androidstudio-&#x96C6;&#x6210;ffmpeg" class="anchor-navigation-ex-anchor" href="#androidstudio-&#x96C6;&#x6210;ffmpeg"><i class="fa fa-link" aria-hidden="true"></i></a>1.2.2. androidStudio &#x96C6;&#x6210;ffmpeg</h3>
<pre><code class="lang-xml">1&#x3001;&#x5C06;&#x9700;&#x8981;&#x7684;so&#x6587;&#x4EF6;&#x548C;&#x5934;&#x6587;&#x4EF6;&#x590D;&#x5236;&#x5230;&#x5DE5;&#x7A0B;&#x4E2D;&#x3002;
2&#x3001;&#x8FDB;&#x884C;&#x76F8;&#x5173;&#x914D;&#x7F6E;&#xFF0C;&#x4EE5;&#x4FBF;&#x751F;&#x6210;&#x9002;&#x7528;&#x4E8E;&#x5BF9;&#x5E94;&#x7684;cpu&#x7684;&#x6700;&#x540E;&#x7684;so&#x3002;
3&#x3001;CMakeLists.txt &#x914D;&#x7F6E;&#x793A;&#x4F8B;
# cmake&#x7248;&#x672C;&#x6700;&#x4F4E;&#x8981;&#x6C42;
cmake_minimum_required(VERSION 3.4.1)

add_library( # &#x5C06;&#x6307;&#x5B9A;&#x7684;cpp&#x6587;&#x4EF6;&#x751F;&#x6210;so&#x6587;&#x4EF6;
             wkplayer
             SHARED
             src/main/cpp/wkplayer.cpp )

# &#x5BFC;&#x5165; ffmpeg&#x9700;&#x8981;&#x7684;&#x5934;&#x6587;&#x4EF6;
include_directories(src/main/cpp/ffmpeg/include)

#&#x6DFB;&#x52A0;libavcodec-57.so
# &#x6307;&#x5B9A;so&#x6587;&#x4EF6;&#x548C;&#x5F15;&#x5165;&#x65B9;&#x5F0F;&#x7B49;&#x4FE1;&#x606F;&#xFF0C;&#x6700;&#x540E;&#x751F;&#x6210; &#x6307;&#x5B9A;&#x540D;&#x5B57;&#x7684; so
add_library( avcodec-57
             SHARED
             IMPORTED)
set_target_properties( avcodec-57
                       PROPERTIES IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg/armeabi/libavcodec-57.so)

#&#x6DFB;&#x52A0;libavdevice-57.so
add_library( avdevice-57
             SHARED
             IMPORTED)
set_target_properties( avdevice-57
                       PROPERTIES IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg/armeabi/libavdevice-57.so)

add_library( avfilter-6
             SHARED
             IMPORTED)
set_target_properties( avfilter-6
                       PROPERTIES IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg/armeabi/libavfilter-6.so)

add_library( avformat-57
             SHARED
             IMPORTED)
set_target_properties( avformat-57
                       PROPERTIES IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg/armeabi/libavformat-57.so)

add_library( avutil-55
             SHARED
             IMPORTED)
set_target_properties( avutil-55
                       PROPERTIES IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg/armeabi/libavutil-55.so)

add_library( swresample-2
             SHARED
             IMPORTED)
set_target_properties( swresample-2
                       PROPERTIES IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg/armeabi/libswresample-2.so)

add_library( swscale-4
             SHARED
             IMPORTED)
set_target_properties( swscale-4
                       PROPERTIES IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg/armeabi/libswscale-4.so)

add_library( postproc-54
             SHARED
             IMPORTED)
set_target_properties( postproc-54
                       PROPERTIES IMPORTED_LOCATION
                       ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg/armeabi/libpostproc-54.so)

find_library( # &#x8C03;&#x7528;&#x7CFB;&#x7EDF;&#x65E5;&#x5FD7;&#x5E93;
              log-lib
              log )

target_link_libraries( # &#x5C06;&#x6240;&#x6709;&#x7684;&#x5E93;&#x6253;&#x5305;&#x5230;&#x4E00;&#x8D77;
                        wkplayer
                        avcodec-57
                        avdevice-57
                        avfilter-6
                        avformat-57
                        avutil-55
                        swresample-2
                        swscale-4
                        postproc-54
                       ${log-lib} )

4&#x3001;&#x5982;&#x679C;&#x8981;&#x7ED9;&#x5176;&#x4ED6;&#x5DE5;&#x7A0B;&#x4F7F;&#x7528;&#xFF0C;&#x63D0;&#x4F9B; wkplayer.so &#x5373;&#x53EF;&#x3002;&#x4E0D;&#x7528;&#x63D0;&#x4F9B;ffmpeg&#x7684;&#x90A3;&#x4E9B;&#x6587;&#x4EF6;&#x3002;
</code></pre>
<h2 id="&#x7248;&#x672C;&#x517C;&#x5BB9;"><a name="&#x7248;&#x672C;&#x517C;&#x5BB9;" class="anchor-navigation-ex-anchor" href="#&#x7248;&#x672C;&#x517C;&#x5BB9;"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. &#x7248;&#x672C;&#x517C;&#x5BB9;</h2>
<pre><code class="lang-xml">#if LIBAVCODEC_VERSION_INT <span class="hljs-tag">&lt; <span class="hljs-attr">AV_VERSION_INT</span>(<span class="hljs-attr">55</span>, <span class="hljs-attr">28</span>, <span class="hljs-attr">1</span>)
#<span class="hljs-attr">define</span> <span class="hljs-attr">av_frame_alloc</span>  <span class="hljs-attr">avcodec_alloc_frame</span>
#<span class="hljs-attr">endif</span>
</span></code></pre>
<h2 id="ffmpeg-&#x5E38;&#x7528;&#x7ED3;&#x6784;&#x4F53;"><a name="ffmpeg-&#x5E38;&#x7528;&#x7ED3;&#x6784;&#x4F53;" class="anchor-navigation-ex-anchor" href="#ffmpeg-&#x5E38;&#x7528;&#x7ED3;&#x6784;&#x4F53;"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. ffmpeg &#x5E38;&#x7528;&#x7ED3;&#x6784;&#x4F53;</h2>
<table>
<thead>
<tr>
<th>&#x540D;&#x79F0;</th>
<th>&#x8BF4;&#x660E; </th>
</tr>
</thead>
<tbody>
<tr>
<td>AVStream</td>
<td>&#x5B58;&#x50A8;&#x6BCF;&#x4E00;&#x4E2A;&#x89C6;&#x9891;/&#x97F3;&#x9891;&#x6D41;&#x4FE1;&#x606F;&#x7684;&#x7ED3;&#x6784;&#x4F53;</td>
</tr>
<tr>
<td>AVOutputFormat</td>
<td></td>
</tr>
<tr>
<td>AVInputFormat</td>
<td></td>
</tr>
<tr>
<td>AVSampleFormat</td>
<td>&#x97F3;&#x9891;&#x91C7;&#x6837;&#x7387;&#x7684;&#x683C;&#x5F0F;</td>
</tr>
<tr>
<td>SwrContext</td>
<td>&#x4E00;&#x822C;&#x7528;&#x4E8E;&#x97F3;&#x9891;&#x91CD;&#x91C7;&#x6837;&#xFF0C;&#x6BD4;&#x5982;&#x91C7;&#x6837;&#x7387;&#x8F6C;&#x6362;&#xFF0C;&#x58F0;&#x9053;&#x8F6C;&#x6362;&#x3002;</td>
</tr>
<tr>
<td>AVFrame</td>
<td>&#x5B58;&#x50A8;&#x4E00;&#x5E27;&#x7684;&#x6570;&#x636E;&#x3002;&#x4F8B;&#x5982;yuv&#x6570;&#x636E;&#xFF0C;&#x662F;&#x5426;&#x5173;&#x952E;&#x5E27;&#x3001;&#x50CF;&#x7D20;&#x7C7B;&#x578B;&#x7B49;</td>
</tr>
<tr>
<td>AVFormatContext</td>
<td>&#x6570;&#x636E;&#x7684;&#x5C01;&#x88C5;&#x683C;&#x5F0F;&#x3001;&#x89C6;&#x97F3;&#x9891;&#x6D41;&#x7684;&#x4E2A;&#x6570;&#x3001;&#x6587;&#x4EF6;&#x540D;&#x3001;&#x6BD4;&#x7279;&#x7387;&#x3001;&#x5143;&#x6570;&#x636E;&#x7B49; </td>
</tr>
<tr>
<td>AVCodecContext</td>
<td>&#x8BB0;&#x5F55;&#x7F16;&#x89E3;&#x7801;&#x7684;&#x4E00;&#x4E9B;&#x4FE1;&#x606F;&#x3002;&#x4F8B;&#x5982; &#x91C7;&#x6837;&#x683C;&#x5F0F;&#x3001;&#x5E73;&#x5747;&#x6BD4;&#x7279;&#x7387;&#x3001;&#x91C7;&#x6837;&#x7387;&#x7B49;</td>
</tr>
<tr>
<td>AVCodec</td>
<td>&#x5B58;&#x50A8;&#x7F16;&#x89E3;&#x7801;&#x5668;&#x4FE1;&#x606F; &#x3002;&#x7F16;&#x89E3;&#x7801;&#x5668;&#x7684;&#x540D;&#x5B57;&#x3001;&#x652F;&#x6301;&#x7684;&#x5E27;&#x7387;&#x3001;&#x7C7B;&#x578B;&#xFF08;&#x89C6;&#x9891;/&#x97F3;&#x9891;/&#x5B57;&#x5E55;&#xFF09;&#x7B49;</td>
</tr>
<tr>
<td>ANativeWindow</td>
<td>opengl&#x5DE5;&#x4F5C;&#x7684;&#x7ED8;&#x56FE;&#x753B;&#x5E03;&#x672C;&#x5730;&#x7A97;&#x53E3;</td>
</tr>
<tr>
<td>SwsContext</td>
<td>&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x89C6;&#x9891;&#x56FE;&#x50CF;&#x7684;&#x8F6C;&#x6362;</td>
</tr>
<tr>
<td>AVPicture</td>
<td></td>
</tr>
<tr>
<td>AVPacket</td>
<td>&#x5B58;&#x50A8;&#x538B;&#x7F29;&#x7F16;&#x7801;&#x6570;&#x636E;&#x76F8;&#x5173;&#x4FE1;&#x606F;</td>
</tr>
</tbody>
</table>
<h2 id="ffmpeg&#x5E38;&#x7528;&#x51FD;&#x6570;"><a name="ffmpeg&#x5E38;&#x7528;&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#ffmpeg&#x5E38;&#x7528;&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>1.5. ffmpeg&#x5E38;&#x7528;&#x51FD;&#x6570;</h2>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;&#x540D;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>av_register_all</td>
<td>&#x6CE8;&#x518C;&#x6240;&#x6709;&#x7EC4;&#x4EF6;</td>
</tr>
<tr>
<td>avformat_network_init</td>
<td>&#x521D;&#x59CB;&#x5316;&#x7F51;&#x7EDC;&#x5E93;</td>
</tr>
<tr>
<td>avformat_network_deinit</td>
<td></td>
</tr>
<tr>
<td>avformat_open_input</td>
<td>&#x6253;&#x5F00;&#x8F93;&#x5165;&#x89C6;&#x9891;&#x6587;&#x4EF6;</td>
</tr>
<tr>
<td>av_find_best_stream</td>
<td>&#x67E5;&#x627E;&#x97F3;&#x9891;&#x6D41;&#x7684; index</td>
</tr>
<tr>
<td>avformat_find_stream_info</td>
<td>&#x83B7;&#x53D6;&#x89C6;&#x9891;&#x6587;&#x4EF6;&#x4FE1;&#x606F;</td>
</tr>
<tr>
<td>avcodec_find_decoder</td>
<td>&#x67E5;&#x627E;&#x89E3;&#x7801;&#x5668;</td>
</tr>
<tr>
<td>avcodec_open</td>
<td></td>
</tr>
<tr>
<td>avcodec_open2</td>
<td>&#x6253;&#x5F00;&#x89E3;&#x7801;&#x5668;</td>
</tr>
<tr>
<td>avcodec_alloc_context3</td>
<td></td>
</tr>
<tr>
<td>avcodec_parameters_to_context</td>
<td></td>
</tr>
<tr>
<td>av_packet_alloc</td>
<td></td>
</tr>
<tr>
<td>av_frame_alloc</td>
<td>&#x7ED9;AVFrame &#x5206;&#x914D;&#x5185;&#x5B58;</td>
</tr>
<tr>
<td>av_frame_free</td>
<td>&#x91CA;&#x653E; AVFrame</td>
</tr>
<tr>
<td>av_packet_free</td>
<td></td>
</tr>
<tr>
<td>avcodec_send_packet</td>
<td>&#x9001;&#x53BB;&#x89E3;&#x7801;</td>
</tr>
<tr>
<td>avcodec_receive_frame</td>
<td></td>
</tr>
<tr>
<td>avformat_alloc_context</td>
<td></td>
</tr>
<tr>
<td>swr_alloc_set_opts</td>
<td></td>
</tr>
<tr>
<td>swr_init</td>
<td></td>
</tr>
<tr>
<td>swr_convert</td>
<td>&#x91CD;&#x91C7;&#x6837;</td>
</tr>
<tr>
<td>sws_getContext</td>
<td>&#x521D;&#x59CB;&#x5316;</td>
</tr>
<tr>
<td>sws_scale</td>
<td>&#x8F6C;&#x6362;&#x50CF;&#x7D20;&#x683C;&#x5F0F;</td>
</tr>
<tr>
<td>sws_freeContext</td>
<td></td>
</tr>
<tr>
<td>av_get_channel_layout_nb_channels</td>
<td></td>
</tr>
<tr>
<td>av_samples_get_buffer_size</td>
<td></td>
</tr>
<tr>
<td>av_packet_unref</td>
<td></td>
</tr>
<tr>
<td>av_read_frame</td>
<td>&#x4ECE;&#x8F93;&#x5165;&#x6587;&#x4EF6;&#x8BFB;&#x53D6;&#x4E00;&#x5E27;&#x538B;&#x7F29;&#x6570;&#x636E; </td>
</tr>
<tr>
<td>avcodec_close()</td>
<td>&#x5173;&#x95ED;&#x89E3;&#x7801;&#x5668;</td>
</tr>
<tr>
<td>avformat_close_input</td>
<td>&#x5173;&#x95ED;&#x8F93;&#x5165;&#x89C6;&#x9891;&#x6587;&#x4EF6;</td>
</tr>
<tr>
<td>av_open_input_file</td>
<td></td>
</tr>
<tr>
<td>av_find_stream_info</td>
<td></td>
</tr>
<tr>
<td>av_find_input_format</td>
<td></td>
</tr>
<tr>
<td>av_close_input_file</td>
<td></td>
</tr>
<tr>
<td>avcodec_register_all</td>
<td>&#x6CE8;&#x518C;&#x7F16;&#x89E3;&#x7801;&#x5668;</td>
</tr>
<tr>
<td>avdevice_register_all</td>
<td>&#x6CE8;&#x518C;&#x8BBE;&#x5907;</td>
</tr>
<tr>
<td>avcodec_alloc_frame</td>
<td></td>
</tr>
<tr>
<td>avpicture_get_size</td>
<td></td>
</tr>
<tr>
<td>avpicture_fill</td>
<td></td>
</tr>
<tr>
<td>img_convert</td>
<td></td>
</tr>
<tr>
<td>avcodec_alloc_context(</td>
<td></td>
</tr>
<tr>
<td>av_free_packet</td>
<td></td>
</tr>
<tr>
<td>av_free</td>
<td></td>
</tr>
<tr>
<td>avnew_steam</td>
<td></td>
</tr>
<tr>
<td>av_write_frame</td>
<td></td>
</tr>
<tr>
<td>dump_format</td>
<td></td>
</tr>
<tr>
<td>avpicture_deinterlace</td>
<td></td>
</tr>
<tr>
<td>ImgReSampleContext</td>
<td></td>
</tr>
<tr>
<td>avformat_open_input</td>
<td>&#x5C1D;&#x8BD5;&#x6253;&#x5F00;&#x8FDE;&#x63A5; &#xFF0C;&#x5931;&#x8D25;&#x8FD4;&#x56DE;&#x503C; &lt; 0</td>
</tr>
<tr>
<td>avformat_find_stream_info</td>
<td>&#x83B7;&#x53D6;&#x97F3;&#x9891;&#x4FE1;&#x606F; &#x5E76;&#x4FDD;&#x5B58;&#x5728;AVFormatContext&#x4E2D;</td>
</tr>
<tr>
<td>avcodec_open2</td>
<td>&#x4E3A;&#x5404;&#x79CD;&#x7ED3;&#x6784;&#x4F53;&#x5206;&#x914D;&#x5185;&#x5B58; &#x548C;&#x4E00;&#x4E9B;&#x5FC5;&#x8981;&#x7684;&#x68C0;&#x67E5;</td>
</tr>
<tr>
<td>av_image_get_buffer_size</td>
<td>&#x8BA1;&#x7B97;&#x7F13;&#x51B2;&#x533A;&#x586B;&#x5145;&#x6240;&#x9700;&#x7684;&#x5927;&#x5C0F;</td>
</tr>
<tr>
<td>av_codec_next</td>
<td>&#x83B7;&#x53D6;&#x89E3;&#x7801;&#x5668;</td>
</tr>
<tr>
<td>av_image_fill_arrays</td>
<td>&#x7ED9;&#x50CF;&#x7D20;&#x6570;&#x636E;&#x5206;&#x914D;&#x7A7A;&#x95F4;</td>
</tr>
<tr>
<td>av_malloc</td>
<td>&#x5206;&#x914D;&#x5185;&#x5B58;</td>
</tr>
<tr>
<td>av_read_frame</td>
<td>&#x83B7;&#x5F97;&#x4E00;&#x5E27;&#x89C6;&#x9891;&#x7684;&#x538B;&#x7F29;&#x6570;&#x636E; &#xFF0C;&#x8FD4;&#x56DE;&#x503C;&lt; 0 &#x4EE3;&#x8868;&#x5931;&#x8D25;</td>
</tr>
<tr>
<td>avcodec_decode_video</td>
<td></td>
</tr>
<tr>
<td>avcodec_decode_video2</td>
<td>&#x89E3;&#x7801;&#x4E00;&#x5E27;&#x538B;&#x7F29;&#x6570;&#x636E;&#x3002; &#x89E3;&#x7801;&#x5931;&#x8D25;&#x7B2C;&#x4E09;&#x4E2A;&#x53C2;&#x6570;&#x8FD4;&#x56DE;&#x503C;&#x4E3A;0</td>
</tr>
</tbody>
</table>
<p>avcodec_decode_video2
av_packet_ref |  &#x628A;&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x7684;&#x5185;&#x5B58;&#x6570;&#x636E;&#x62F7;&#x8D1D;&#x5230;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x7684;&#x5185;&#x5B58;&#x4E2D;
ANativeWindow_lock| &#x9501;&#x5B9A; ANativeWindow , &#x8FD4;&#x56DE;&#x503C; &#x5C0F;&#x4E8E;0 &#x4EE3;&#x8868;&#x5931;&#x8D25;
ANativeWindow_unlockAndPost | &#x91CA;&#x653E;&#x9501;&#x5B9A; ANativeWindow
ANativeWindow_release|
ANativeWindow_setBuffersGeometry | &#x8BBE;&#x7F6E;ANativeWindow &#x7684;&#x7F13;&#x5B58;&#x5927;&#x5C0F;,&#x8FD4;&#x56DE;&#x503C;&lt; 0&#x8868;&#x793A;&#x5931;&#x8D25;
ANativeWindow_fromSurface| surfaceview&#x548C;ANativeWindow&#x7ED1;&#x5B9A;</p>
<h2 id="&#x89C6;&#x97F3;&#x89C6;&#x9891;&#x540C;&#x6B65;"><a name="&#x89C6;&#x97F3;&#x89C6;&#x9891;&#x540C;&#x6B65;" class="anchor-navigation-ex-anchor" href="#&#x89C6;&#x97F3;&#x89C6;&#x9891;&#x540C;&#x6B65;"><i class="fa fa-link" aria-hidden="true"></i></a>1.6. &#x89C6;&#x97F3;&#x89C6;&#x9891;&#x540C;&#x6B65;</h2>
<h3 id="&#x4E3A;&#x4EC0;&#x4E48;&#x4F1A;&#x51FA;&#x73B0;&#x97F3;&#x9891;&#x4E0D;&#x540C;&#x6B65;&#xFF1F;"><a name="&#x4E3A;&#x4EC0;&#x4E48;&#x4F1A;&#x51FA;&#x73B0;&#x97F3;&#x9891;&#x4E0D;&#x540C;&#x6B65;&#xFF1F;" class="anchor-navigation-ex-anchor" href="#&#x4E3A;&#x4EC0;&#x4E48;&#x4F1A;&#x51FA;&#x73B0;&#x97F3;&#x9891;&#x4E0D;&#x540C;&#x6B65;&#xFF1F;"><i class="fa fa-link" aria-hidden="true"></i></a>1.6.1. &#x4E3A;&#x4EC0;&#x4E48;&#x4F1A;&#x51FA;&#x73B0;&#x97F3;&#x9891;&#x4E0D;&#x540C;&#x6B65;&#xFF1F;</h3>
<pre><code class="lang-xml">&#x7406;&#x60F3;&#x72B6;&#x6001;&#x4E0B;&#x89C6;&#x97F3;&#x9891;&#x662F;&#x540C;&#x6B65;&#x7684;&#xFF0C;&#x4E0D;&#x8FC7;&#x5728;&#x73B0;&#x5B9E;&#x573A;&#x666F;&#x4E0B;&#xFF0C;&#x7531;&#x4E8E;&#x673A;&#x5668;&#x6027;&#x80FD;&#x3001;&#x8BA1;&#x7B97;&#x7CBE;&#x5EA6;&#x504F;&#x5DEE;&#x7B49;&#x4F1A;&#x5BFC;&#x81F4;&#x97F3;&#x9891;&#x548C;&#x89C6;&#x9891;&#x7684;&#x540C;&#x6B65;&#x6027;&#x4F1A;&#x6162;&#x6162;&#x5730;&#x51FA;&#x73B0;&#x504F;&#x5DEE;&#x3002;

DTS&#xFF08;Decoding Time Stamp&#xFF09;: &#x89E3;&#x7801;&#x65F6;&#x95F4;&#x6233;
PTS&#xFF08;Presentation Time Stamp&#xFF09;&#xFF1A; &#x663E;&#x793A;&#x65F6;&#x95F4;&#x6233;
&#x97F3;&#x9891;&#x3001;&#x53EA;&#x6709;I&#x5E27;&#x548C;P&#x5E27;&#x7684;&#x89C6;&#x9891;&#x4E2D; &#xFF0C;DTS&#x548C;PTS&#x662F;&#x4E00;&#x6837;&#x7684;&#x3002;
&#x5F53;&#x89C6;&#x9891;&#x5E27;&#x4E2D;&#x6709;B&#x5E27;&#x7684;&#x65F6;&#x5019;&#xFF0C; DTS &#x548C; PTS &#x662F;&#x4E0D;&#x4E00;&#x6837;&#x7684;&#x3002; &#x56E0;&#x4E3A;B&#x5E27;&#x8DDF;&#x524D;&#x540E;&#x5E27;&#x90FD;&#x6709;&#x5173;&#x7CFB;&#xFF0C;&#x6240;&#x4EE5;&#x89E3;&#x7801;&#x548C;&#x663E;&#x793A;&#x987A;&#x5E8F;&#x5E76;&#x4E0D;&#x662F;&#x4E00;&#x6837;&#x7684;&#x3002;
</code></pre>
<h3 id="&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x65B9;&#x6848;"><a name="&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x65B9;&#x6848;" class="anchor-navigation-ex-anchor" href="#&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x65B9;&#x6848;"><i class="fa fa-link" aria-hidden="true"></i></a>1.6.2. &#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x65B9;&#x6848;</h3>
<pre><code class="lang-xml">1&#x3001;&#x5C06;&#x89C6;&#x9891;&#x540C;&#x6B65;&#x5230;&#x97F3;&#x9891;&#x4E0A;
&#x4EE5;&#x97F3;&#x9891;&#x7684;&#x64AD;&#x653E;&#x901F;&#x5EA6;&#x4E3A;&#x57FA;&#x51C6;&#x6765;&#x540C;&#x6B65;&#x89C6;&#x9891;&#x3002;&#x89C6;&#x9891;&#x6BD4;&#x97F3;&#x9891;&#x64AD;&#x653E;&#x6162;&#x4E86;&#xFF0C;&#x52A0;&#x5FEB;&#x5176;&#x64AD;&#x653E;&#x901F;&#x5EA6;&#xFF1B;&#x5FEB;&#x4E86;&#xFF0C;&#x5219;&#x5EF6;&#x8FDF;&#x64AD;&#x653E;&#x3002;
&#x7531;&#x4E8E;&#x67D0;&#x4E9B;&#x751F;&#x7269;&#x5B66;&#x7684;&#x539F;&#x7406;&#xFF0C;&#x4EBA;&#x5BF9;&#x58F0;&#x97F3;&#x7684;&#x53D8;&#x5316;&#x6BD4;&#x8F83;&#x654F;&#x611F;&#xFF0C;&#x4F46;&#x662F;&#x5BF9;&#x89C6;&#x89C9;&#x53D8;&#x5316;&#x4E0D;&#x592A;&#x654F;&#x611F;&#x3002;&#x6240;&#x4EE5;&#x4E00;&#x822C;&#x91C7;&#x7528;&#x8FD9;&#x79CD;&#x65B9;&#x6848;&#x3002;
2&#x3001;&#x5C06;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x5230;&#x89C6;&#x9891;&#x4E0A;
3&#x3001;&#x9009;&#x62E9;&#x4E00;&#x4E2A;&#x5916;&#x90E8;&#x65F6;&#x949F;&#x4E3A;&#x57FA;&#x51C6;&#xFF0C;&#x89C6;&#x9891;&#x548C;&#x97F3;&#x9891;&#x7684;&#x64AD;&#x653E;&#x901F;&#x5EA6;&#x90FD;&#x4EE5;&#x8BE5;&#x65F6;&#x949F;&#x4E3A;&#x6807;&#x51C6;
</code></pre>
<h3 id="&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x539F;&#x7406;"><a name="&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x539F;&#x7406;" class="anchor-navigation-ex-anchor" href="#&#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x539F;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>1.6.3. &#x89C6;&#x97F3;&#x9891;&#x540C;&#x6B65;&#x539F;&#x7406;</h3>
<pre><code class="lang-xml">&#x89C6;&#x97F3;&#x9891;&#x7684;&#x540C;&#x6B65;&#x8FC7;&#x7A0B;&#x662F;&#x4E00;&#x4E2A;&#x52A8;&#x6001;&#x8FC7;&#x7A0B;&#xFF0C;&#x5FEB;&#x5219;&#x7B49;&#x5F85;&#xFF0C;&#x6162;&#x5219;&#x52A0;&#x5FEB;&#x64AD;&#x653E;&#xFF0C;&#x5728;&#x8FD9;&#x6837;&#x7684;&#x8FC7;&#x7A0B;&#x4E2D;&#x5B9E;&#x73B0;&#x540C;&#x6B65;&#x64AD;&#x653E;&#x3002;
</code></pre>
<h3 id="&#x65F6;&#x95F4;&#x6233;&#x548C;&#x65F6;&#x95F4;&#x57FA;&#x7684;&#x7406;&#x89E3;"><a name="&#x65F6;&#x95F4;&#x6233;&#x548C;&#x65F6;&#x95F4;&#x57FA;&#x7684;&#x7406;&#x89E3;" class="anchor-navigation-ex-anchor" href="#&#x65F6;&#x95F4;&#x6233;&#x548C;&#x65F6;&#x95F4;&#x57FA;&#x7684;&#x7406;&#x89E3;"><i class="fa fa-link" aria-hidden="true"></i></a>1.6.4. &#x65F6;&#x95F4;&#x6233;&#x548C;&#x65F6;&#x95F4;&#x57FA;&#x7684;&#x7406;&#x89E3;</h3>
<pre><code class="lang-xml">Unix &#x65F6;&#x95F4;&#x6233;
&#x662F;&#x4E00;&#x79CD;&#x65F6;&#x95F4;&#x8868;&#x793A;&#x65B9;&#x5F0F;&#xFF0C;&#x5B9A;&#x4E49;&#x4E3A;&#x4ECE;&#x683C;&#x6797;&#x5A01;&#x6CBB;&#x65F6;&#x95F4;1970&#x5E74;01&#x6708;01&#x65E5;00&#x65F6;00&#x5206;00&#x79D2;&#x8D77;&#x81F3;&#x73B0;&#x5728;&#x7684;&#x603B;&#x79D2;&#x6570;&#x3002;

ffmpeg&#x4E2D;&#x7684;&#x65F6;&#x95F4;&#x6233;&#x6982;&#x5FF5;&#x8DDF; Unix&#x7684;&#x65F6;&#x95F4;&#x6233;&#x6982;&#x5FF5;&#x662F;&#x6709;&#x533A;&#x522B;&#x7684;&#xFF0C;&#x6211;&#x7684;&#x7406;&#x89E3;&#x5982;&#x4E0B;&#xFF1A;
&#x65F6;&#x95F4;&#x57FA;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;&#x523B;&#x5EA6;&#x6216;&#x6B65;&#x957F;&#xFF0C;&#x4F8B;&#x5982;&#x65F6;&#x95F4;&#x57FA;&#x4E3A;1&#x65F6;&#xFF0C;&#x65F6;&#x95F4;&#x6233;&#x6BCF;&#x52A0;1&#x5C31;&#x4EE3;&#x8868;&#x589E;&#x52A0;&#x4E00;&#x79D2;&#x949F;&#xFF0C;
&#x65F6;&#x95F4;&#x57FA;&#x4E3A;2&#x65F6;&#xFF0C;&#x65F6;&#x95F4;&#x6233;&#x6BCF;&#x52A0;1&#x5C31;&#x4EE3;&#x8868;&#x589E;&#x52A0;2&#x79D2;&#xFF0C;&#x65F6;&#x95F4;&#x57FA;&#x4E3A; 1/25 &#x65F6;&#xFF0C;&#x65F6;&#x95F4;&#x6233;&#x6BCF;&#x52A0;1&#x5C31;&#x4EE3;&#x8868;&#x589E;&#x52A0; 1/25 &#x79D2; &#x3002;
&#x5982;&#x679C;&#x4EE5;&#x89C6;&#x9891;&#x5F00;&#x59CB;&#x70B9;&#x5F00;&#x59CB;&#x8BA1;&#x65F6; &#xFF0C;&#x65F6;&#x95F4;&#x57FA;&#x4E3A; 2&#xFF0C; &#x65F6;&#x95F4;&#x6233;&#x4E3A;2&#x7684;&#x65F6;&#x5019; &#xFF0C;&#x6B64;&#x65F6;&#x7684;&#x64AD;&#x653E;&#x65F6;&#x957F;&#x5C31;&#x662F; 4&#x79D2; &#x3002;

----------------------------------------------------------------
ffmpeg&#x5185;&#x90E8;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x65F6;&#x95F4;&#x57FA; AV_TIME_BASE

#define         AV_TIME_BASE   1000000
#define         AV_TIME_BASE_Q   (AVRational){1, AV_TIME_BASE}

timestamp(ffmpeg&#x5185;&#x90E8;&#x65F6;&#x95F4;&#x6233;) = AV_TIME_BASE * time(&#x79D2;)
time(&#x79D2;) = AV_TIME_BASE_Q * timestamp(ffmpeg&#x5185;&#x90E8;&#x65F6;&#x95F4;&#x6233;)
----------------------------------------------------------------

&#x4E0D;&#x540C;&#x65F6;&#x95F4;&#x57FA;&#x4E0B;&#x7684;&#x65F6;&#x95F4;&#x6233;&#x8F6C;&#x6362;
&#x82E5; t&#x4EE3;&#x8868;&#x65F6;&#x95F4; &#xFF0C;base1, base2 &#x4EE3;&#x8868; &#x65F6;&#x95F4;&#x57FA; &#xFF0C; stamps1 ,stamps2 &#x4EE3;&#x8868;&#x65F6;&#x95F4;&#x6233;
&#x8F6C;&#x6362;&#x516C;&#x5F0F;&#x4E3A;  stamps1 =  (stamps2 * base2 ) / base1
&#x5728;ffmpeg&#x4E2D;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x5185;&#x7F6E;&#x51FD;&#x6570;

&#x5C06;&#x5728;stream-&gt;time_base&#x65F6;&#x95F4;&#x57FA;&#x4E0B;&#x7684;&#x65F6;&#x95F4;&#x6233;pts &#x8F6C;&#x4E3A; AV_TIME_BASE&#x65F6;&#x95F4;&#x6233;&#x4E0B;&#x7684;&#x65F6;&#x95F4;&#x6233;time
int64_t time = av_rescale_q(pts, stream-&gt;time_base, AV_TIME_BASE_Q);
</code></pre>
<h2 id="windows-&#x4E0A;&#x4F7F;&#x7528;-ffmpeg"><a name="windows-&#x4E0A;&#x4F7F;&#x7528;-ffmpeg" class="anchor-navigation-ex-anchor" href="#windows-&#x4E0A;&#x4F7F;&#x7528;-ffmpeg"><i class="fa fa-link" aria-hidden="true"></i></a>1.7. Windows &#x4E0A;&#x4F7F;&#x7528; ffmpeg</h2>
<h3 id="&#x5B89;&#x88C5;ffmpeg"><a name="&#x5B89;&#x88C5;ffmpeg" class="anchor-navigation-ex-anchor" href="#&#x5B89;&#x88C5;ffmpeg"><i class="fa fa-link" aria-hidden="true"></i></a>1.7.1. &#x5B89;&#x88C5;ffmpeg</h3>
<pre><code class="lang-xml">1&#x3001; &#x4E0B;&#x8F7D;&#x5BF9;&#x5E94;&#x7684;&#x7248;&#x672C; https://ffmpeg.zeranoe.com/builds/
2&#x3001; &#x89E3;&#x538B;&#x5230;&#x672C;&#x5730;
3&#x3001; &#x5C06; xxx\ffmpeg\bin &#x914D;&#x7F6E;&#x5230;&#x73AF;&#x5883;&#x53D8;&#x91CF; &#x3002;
&#x5982;&#x679C;&#x4E0D;&#x914D;&#x7F6E;&#x5C31;&#x4E0D;&#x80FD;&#x5168;&#x5C40;&#x4F7F;&#x7528;&#x547D;&#x4EE4;&#x3002;
4&#x3001;&#x6D4B;&#x8BD5;&#x662F;&#x5426;&#x6210;&#x529F;
ffmpeg &#x2013;version
</code></pre>
<h3 id="ffmpeg-&#x5E38;&#x7528;&#x547D;&#x4EE4;"><a name="ffmpeg-&#x5E38;&#x7528;&#x547D;&#x4EE4;" class="anchor-navigation-ex-anchor" href="#ffmpeg-&#x5E38;&#x7528;&#x547D;&#x4EE4;"><i class="fa fa-link" aria-hidden="true"></i></a>1.7.2. ffmpeg &#x5E38;&#x7528;&#x547D;&#x4EE4;</h3>
<p>&#x4EE5;&#x4E0B;&#x53EA;&#x662F;&#x57FA;&#x672C;&#x547D;&#x4EE4;&#xFF0C;&#x9AD8;&#x7EA7;&#x5E94;&#x7528;&#x8BF7;&#x67E5;&#x9605;&#x6587;&#x6863;</p>
<pre><code class="lang-xml">ffmpeg -i [&#x8F93;&#x5165;&#x6587;&#x4EF6;&#x540D;] [&#x53C2;&#x6570;&#x9009;&#x9879;] -f [&#x683C;&#x5F0F;] [&#x8F93;&#x51FA;&#x6587;&#x4EF6;]

// H264 &#x8F6C; mp4
ffmpeg -i test1.h264 -vcodec copy -f mp4 test.mp4

// .ts &#x8F6C; mp4
ffmpeg -i test1.ts -vcodec copy -f mp4  test2.mp4

// mp4 &#x8F6C; flv
ffmpeg -i test1.mp4 -acodec copy -vcodec copy -f flv test1.flv

// &#x63D0;&#x53D6;&#x89C6;&#x9891;&#x5173;&#x952E;&#x5E27;
ffmpeg -i test1.mp4 -vf select=&apos;eq(pict_type\,I)&apos; -vsync 2 -s 1920*1080 -f image2 core-%03d.jpeg

// &#x89C6;&#x9891;&#x622A;&#x53D6;
ffmpeg  -i ./test2.mp4 -vcodec copy -acodec copy -ss 00:00:08 -to 00:00:30 ./cutout1.mp4 -y

// &#x4FEE;&#x6539;&#x89C6;&#x9891;&#x64AD;&#x653E;&#x901F;&#x5EA6;
// -an&#x7981;&#x7528;&#x58F0;&#x97F3;  setpts&#x8303;&#x56F4;[0.25, 4]&#xFF0C;0.5&#x662F;&#x4E00;&#x500D;&#x901F;&#x5EA6;
ffmpeg -i test2.mp4 -an -filter:v &quot;setpts=0.5*PTS&quot; out2.mp4

// &#x6DFB;&#x52A0;&#x6587;&#x5B57;&#x6C34;&#x5370;
ffmpeg -i test2.mp4 -vf &quot;drawtext=fontfile=simhei.ttf: text=&apos;&#x7248;&#x6743;&#x7533;&#x660E;&apos;:x=200:y=100:fontsize=24:fontcolor=yellow:shadowy=2&quot; out3.mp4

// &#x6DFB;&#x52A0;&#x56FE;&#x7247;&#x6C34;&#x5370;
ffmpeg -i test2.mp4 -i mark.png -filter_complex &quot;[1:v]colorkey=0x000000:0.6:1.0[ckout];[0:v][ckout]overlay=x=W-w-10:y=0[out]&quot; -map &quot;[out]&quot; -movflags faststart out4.mp4

// &#x89C6;&#x9891;&#x8F6C;gif
// &#x4ECE;25&#x79D2;&#x5F00;&#x59CB;&#xFF0C;&#x622A;&#x53D6;5&#x79D2; &#x751F;&#x6210;gif
ffmpeg -ss 25 -t 5 -i aa.mp4  -f gif aa.gif

// &#x63D0;&#x53D6;&#x97F3;&#x9891;&#x4E3A;mp3
ffmpeg -i aa.mp4 -f mp3 a.mp3

// &#x63D0;&#x53D6;&#x89C6;&#x9891; &#xFF08;&#x5220;&#x9664;&#x58F0;&#x97F3;&#xFF09;
ffmpeg -i aa.mp4 -vcodec copy -an  bb.avi
ffmpeg -i aa.mp4 -vcodec copy -an  bb.mp4

// &#x5C4F;&#x5E55;&#x5F55;&#x5236;
// &#x5168;&#x5C40;&#x5F55;&#x5236;
ffmpeg -f gdigrab -i desktop out.mp4
// &#x5C40;&#x90E8;&#x5F55;&#x5236;
ffmpeg -f gdigrab -framerate 25 -offset_x 10 -offset_y 20 -video_size 640x480 -i desktop out2.mp4

// &#x56FE;&#x7247;&#x5408;&#x6210;&#x89C6;&#x9891; &#xFF08;&#x5E26;&#x58F0;&#x97F3;&#xFF09;
&#x672A;&#x6D4B;&#x8BD5;&#x3002;
// &#x56FE;&#x7247;&#x5408;&#x6210;&#x89C6;&#x9891; &#xFF08;&#x4E0D;&#x5E26;&#x58F0;&#x97F3;&#xFF09;
&#x672A;&#x6D4B;&#x8BD5;&#x3002;
//&#x89C6;&#x9891;&#x62FC;&#x63A5;
&#x5C06;&#x4E24;&#x4E2A;&#x89C6;&#x9891; &#x6C34;&#x5E73;&#x62FC;&#x63A5; &#x6216;&#x8005;&#x5782;&#x76F4;&#x62FC;&#x63A5;&#x3002; &#x672A;&#x6D4B;&#x8BD5;&#x3002;
</code></pre>
<footer class="page-footer"><span class="copyright">&#x65E0;&#x7248;&#x6743; &#x53EF;&#x4EE5;&#x65E0;&#x9650;&#x5236;&#x4F7F;&#x7528;&#xFF01; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2019-12-24 10:23:36
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../SDL/SDL基础.html" class="navigation navigation-prev " aria-label="Previous page: SDL基础">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="ffmpeg基础.html" class="navigation navigation-next " aria-label="Next page: ffmpeg基础">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"ffmpeg","level":"1.8","depth":1,"next":{"title":"ffmpeg基础","level":"1.8.1","depth":2,"path":"chinese/ffmpeg/ffmpeg基础.md","ref":"chinese/ffmpeg/ffmpeg基础.md","articles":[]},"previous":{"title":"SDL基础","level":"1.7.1","depth":2,"path":"chinese/SDL/SDL基础.md","ref":"chinese/SDL/SDL基础.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-search","search-plus","todo","anchor-navigation-ex","copy-code-button","versions-select","fontsettings","sharing","tbfed-pagefooter","donate","local-video","splitter","edit-link","expandable-chapters","favicon","theme-comscore","local-video"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"无版权 可以无限制使用！","modify_label":"该文件更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"todo":{},"splitter":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"versions-select":{"type":"branches"},"donate":{"alipay":"https://gitee.com/hnyer/filesOfGitbook/raw/master/files/201803011956_osChina_支付宝收款码.png","alipayText":"支付宝打赏","button":"打赏","title":"","wechat":"https://gitee.com/hnyer/filesOfGitbook/raw/master/files/201803011956_osChina_微信收款码.png","wechatText":"微信打赏"},"fontsettings":{"family":"sans","size":2,"theme":"sepia"},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"favicon":{"shortcut":"assets/images/favicon.ico","bookmark":"assets/images/favicon.ico"},"theme-comscore":{},"local-video":{},"copy-code-button":{},"versions":{"options":[{"value":"https://www.aivin666.cn/java_android/","text":"v1.0"}]},"sharing":{"all":["facebook","google","twitter","weibo","instapaper"],"facebook":false,"google":true,"instapaper":false,"twitter":false,"vk":false,"weibo":true},"edit-link":{"label":"托管页面","base":"https://www.baidu.com/"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"Aivin","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Aivin开发笔记","language":"zh-hans","gitbook":"*","description":"Aivin开发笔记"},"file":{"path":"chinese/ffmpeg/ffmpeg基础.md","mtime":"2019-12-24T02:23:36.198Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-12-24T10:38:14.517Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-versions-select/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

